home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
pasclern.zip
/
CONVERT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-04-01
|
881b
|
29 lines
PROGRAM convert_from_type_to_type;
VAR index,count : INTEGER;
error_ind : INTEGER;
size,cost : REAL;
letter : CHAR;
name,amount : STRING[12];
BEGIN
index := 65;
count := 66;
cost := 124.678;
amount := '12.4612';
letter := chr(index); (* convert integer to char *)
size := count; (* convert integer to real *)
index := round(cost); (* real to integer, rounded *)
count := trunc(cost); (* real to integer, truncated *)
index := ord(letter); (* convert char to integer *)
str(count,name); (* integer to string of char *)
val(amount,size,error_ind); (* string to real note that
"err_ind" is used for return-
ing an error code *)
WRITELN('Name is ',name,' and size is ',size:10:4);
END.